Kepler is an experimental tool for editing two dimensional line drawings. A Kepler graph consists of a list of points (stars) and a list of objects (constellations) based on a number of stars. Direct manipulation is provided on the level of stars rather than on the level of constellations. If one moves a star, then all constellations depending on this star are moved too. Stars may be used by more than one constellation, e.g. the end point of a line may be the start point of another line (polygon). Beside points entered with the mouse, Kepler supports points (Planets) whose position depend on other points. The possibility to calculate the position of points brings a limited form of constraints into the editor. Kepler may also be used to construct graphical command interfaces by means of buttons. A button is a sensitive rectangular area, that gets control whenever a mouse click happens inside the button. Kepler tries to support both terminal based and host based display systems by giving the user the control over graphical animation of editing operations.
Kepler tries to follow the Oberon conventions for mouse usage as close as possible.
Mouse Buttons:
primary secondary
left set new focus point or move focus point
left middle copy selection
left right [activate star marked button] drag point
middle move selection
middle left drag selection
middle right drag origin
right extend selection
right left delete selection
right middle copy over
left + middle + right cancel
Kepler.Open file [grid]
opens a viewer and loads a graph from file. If file does not exist a new graph is opened. The optional grid argument (default = 5) specifies the mouse alignment as described in Kepler.SetGrid.
Kepler.Store
analogous to Edit.Store. Creates a backup file by appending the suffix ".Bak" to the file name.
Kepler.Print printer [n] (* | file)
prints n copies (default: n = 1) of the star marked graphics or the graphics in the specified file.
Kepler.SetGrid n
sets the grid (mouse alignment) of the star marked Kepler frame to n pixels. The grid is always aligned to the origin of the graph but is invariant against zooming.
Kepler.SetScale n
sets the scaling factor of the star marked Kepler frame to n.
Meaningful numbers for n are 1, 2, 4, or 8 where 1 means 300dpi laser printer resolution and 4 is the default value.
Kepler.Reset
resets the origin of the star-marked Kepler graph.
KeplerElems.Insert
inserts an element that may contain a Kepler graph at the caret position into a Write text. Middle clicking the new element opens a viewer with a copy of the (initially empty) graph and sets a default mouse grid. A left mouse click focuses the element for "in-situ" editing. KeplerElems preserve the mouse grid of a graph.
KeplerElems.Update
calculates the new bounding box of the graph and updates the edited element.
Inserting Objects
To insert new objects into a graph proceed in the following two steps:
1. draw the points that define the object (focus points). Click the left mouse button to draw a new focus point. The focus may be an arbitrary number of points (e.g.
). Pressing the escape key removes all focus points, pressing the backspace key removes the last one. As a side effect, defining a focus point also results in acquiring the keyboard focus.
2. execute a command that inserts the object at the focus position (e.g. Kepler1.NewRectangle which needs two focus points). An alternative way of activating the NewRectangle command is to activate a button associated with the NewRectangle command(e.g.
in the palette below for Kepler1.NewRectangle). Mouse clicks within buttons have the following standard behaviour.
primary secondary
middle execute command
middle right show command
An alternative way to insert an object is to define a new focus point (mouse left) and interclicking the right mouse button in order to activate the star marked button, i.e. the button that is marked by the global Oberon Star marker.
Note that graphical tools (e.g. the one shown below) are normal Kepler graphs, hence, they may be customized and extended to fit the user's needs.
Text Captions
A text caption is a single_line text displayed in a single font relative to a single point. Alignment is either base_left, base_right, base_centered, centered, top_left, top_centered or top_left (0, 1, 2, 3, 4, 5, 6 resp.). Text captions may be inserted into a graphics by setting a focus point and typing characters or by "copying over" the most recent text selection. Terminating a caption with TAB or CR opens a new caption with the same attributes at the next focus point. The commands Kepler1.ChangeFont and Kepler1.ChangeAlign may be used to change the corresponding attribute of the selected captions.
Selecting Objects
Dragging the mouse while pressing the right button defines a selection rectangle. Releasing the mouse extends the selection by all points within this area. Pressing the escape key deselects all points, right clicking a point (without dragging) toggles the selection state of this point. Right clicking within the bounding box of an object (without dragging) selects all points of the object. Selection is always performed on the level of points rather than on the level of objects. Objects are selected indirectly by selecting their defining points. Therefore, an object may be unselected, partially selected, or totally selected. Several operations (move, copy, delete) may be applied to the selection.
Moving Objects
Dragging the mouse while pressing the middle button defines a move vector. Releasing the mouse moves all selected points by the defined vector. Interclicking the left button results in graphical animation. Interclicking the right button (but not both) results in moving the origin of the frame by the defined vector (scrolling). The cursur keys (up, down, left, and right) may be used for moving the selection by one screen pixel.
Copying Objects
Defining a move vector by two focus points, interclicking the middle button and releasing the mouse copies all fully selected objects of the most recent selection and moves the copied objects by the given vector. Another way of copying is to define the move vector first, then make a selection with middle interclick and release the mouse (copyover). Objects may be copied across viewer boundaries.
Deleting Objects
selecting points and interclicking the left button deletes all fully selected objects. Pressing the DEL-key deletes all objects that are at least partially selected. The command Kepler.Recall may be used to undo the most recent deletion.
Reusing Points
existing points may be reused for other objects by making them focus points again (left mouse button). Reusing points may be useful e.g. for constructing polygons out of straight lines where the end point of a line segment is the start point of the next one. Reused focus points may be continously dragged by interclicking the right mouse button. They are marked as
to distinct them from newly entered points (e.g.
Commands working on a set of selected points are:
Kepler.Split
splits all selected points that are used by more than one object.
Kepler.Join
takes one focus point and merges all selected points into this point.
Kepler.Constellations [minstate]
opens a viewer and shows all constellations with state >= minstate. Meaningful values for minstate are 0 (all), 1 (partially selected=default), or 2 (fully selected).. For each constellation a surrogate and the type name is displayed. Kepler.Delete and Kepler.SendBack may be a applied to the selected line.
Kepler.AlignX
takes one focus point and aligns the selected points in the focus graph to the x coordinate of the focus point.
Kepler.AlignY
takes one focus point and aligns the selected points in the focus graph to the y coordinate of the focus point.
Kepler.AlignToGrid
aligns the selected points in the star marked viewer to grid positions.
Kepler.ScalePoints
takes three focus points and applies a linear transformation to the selected points such that the first focus point is invariant, and the second is moved to the third.
Planets
are points whose position is not defined interactively but by the result of a computation depending on the constellation of other points. A planet is automatically repositioned whenever its underlying constellation is changed. Planets may be selected (represented as
), copied and deleted like other constellations. An example for a planet is the middle point between two points:
Available Extensions
The following lists some already existing extensions together with their expected arguments where (n) means the number of focus points. Note that the module names have simply be enumerated because they are not intended to be exposed to the user (they are normally hidden behind buttons).
Kepler9: some planet classes useful for geometric constructions
CircleIntersection (4)
the cutting points between two circles
CircleLineIntersection (4)
the cutting points between a circle and a line
Extension (2)
the end point of a line with doubled length
LineIntersection (4)
the cutting point between two lines
Parallel (3)
the end point of a line parallel to another line
RightAngle (3)
the cutting point of two lines forming a right angle
Tangent (3)
the tangent points on a circle
The rules for setting the focus points in the right order are
- round shapes first
- shapes with multiple points before single points
Design Notes
Kepler has been designed as an extensible application, i.e. it consists of a kernel part and a potentially unlimited number of extensions. The kernel part deals only with abstract objects and has no idea of lines, rectangles, circles, or the like. It is decomposed into three modules following the canonical decomposition of Oberon applications (KeplerGraphics, KeplerFrames, Kepler). Functionality is added by implementing concrete classes, in particular by defining subtypes of planets or constellations and thereby filling in the abstract method slots. To simplify the implementation of concrete object classes, several design decisions have been taken:
1. the constellations are not concerned with editing themself
2. drawing, erasing, printing and zooming have been unified (KeplerPorts)
3. support for generic instantiation (Files, Types)